# -*- coding: utf-8 -*-
"""
超级最小化MES配置 - 仅Django核心功能
"""
import os
import sys

# 基础路径配置
PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__))
BASE_DIR = PROJECT_ROOT

# 调试模式
DEBUG = True
ALLOWED_HOSTS = ['*']

# 密钥
SECRET_KEY = 'your-secret-key-here-change-in-production'

# 仅Django核心应用 - 无任何第三方依赖
INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.sites',
    
    # 第三方库
    'mptt',
    'django_extensions',
    
    # MES核心应用 - 先从无依赖的开始
    'apps.material', 
    'apps.device',
    'apps.quality',
    'apps.maintenance',
    'apps.person',
    'apps.customer',
    'apps.productcatalog',
    'apps.manufactureplan',
    'apps.technologies',
    'apps.companydepartment',
    'apps.profiles',
    'apps.permissions',
    'apps.report',
    'apps.utils',
    'apps.about',
    'apps.blog',
    'apps.djangovoice',
    'apps.qhonuskan_votes',
    'apps.serv',
    'apps.extensions',
    
    # 暂时禁用有xadmin依赖的应用
    # 'apps.warehouse',  # 依赖yt_barcode
    # 'apps.workflows',  # 可能有依赖
    # 'apps.yt_report',
    # 'apps.yt_timesheet',
    # 'apps.yt_workflows',
    # 'apps.yt_actstream',
    # 'apps.yt_barcode',  # 依赖xadmin
    # 'apps.yt_file',
    # 'apps.yt_log',
    # 'apps.yt_object',
    # 'apps.xadmin',
]

# 中间件
MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

# URL配置
ROOT_URLCONF = 'urls_minimal'

# 模板配置
TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [os.path.join(BASE_DIR, 'templates')],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
                'django.template.context_processors.static',
                'django.template.context_processors.media',
            ],
        },
    },
]

# 数据库配置
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'ultra_minimal.db'),
    }
}

# 国际化
LANGUAGE_CODE = 'zh-hans'
TIME_ZONE = 'Asia/Shanghai'
USE_I18N = True
USE_L10N = True
USE_TZ = True
SITE_ID = 1

# 静态文件配置
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')

# 媒体文件配置
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')

# 认证配置
LOGIN_URL = '/admin/login/'
LOGIN_REDIRECT_URL = '/admin/'
LOGOUT_REDIRECT_URL = '/admin/'

# 默认主键字段类型
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' 